package org.lex.ftp.ui.speed;

import javax.swing.JTextArea;
import javax.swing.event.DocumentEvent;

import org.lex.swing.DocumentAdapter;


public class InputDocumentListener extends DocumentAdapter {
	private SpeedPane pane = null;
	private JTextArea textArea = null;

	public InputDocumentListener(SpeedPane pane, JTextArea textArea) {
		super();
		this.pane = pane;
		this.textArea = textArea;
	}

	public void documentChanged(DocumentEvent e) {
		String text = this.textArea.getText();
		if (false == this.verify(text))
			return;
		pane.parseInput(text);
	}

	private boolean verify(String value) {
		if (null == value || 0 == value.trim().length())
			return false;
		return true;
	}
}
